package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 2025/5/8 12:33
 */
@Slf4j
@RestController
@RequestMapping("/admin/shop")
@AllArgsConstructor
@Api(tags = "管理端店铺相关接口")
public class ShopController {

    private  ShopService shopService;

    /**
     * 获取店铺状态
     * @return
     */
    @RequestMapping("/status")
    @ApiOperation("获取店铺状态")
    public Result<Integer> getStatus(){
        log.info("获取店铺状态");
        Integer status = shopService.getStatus();
        return Result.success(status);
    }

    /**
     * 设置店铺状态
     * @param status
     * @return
     */
    @ApiOperation("设置店铺状态")
    @PutMapping("{status}")
    public Result changeStatus(@PathVariable Integer status){
        log.info("设置店铺状态：{}",status);
        shopService.changeStatus(status);
        return Result.success();
    }


}
